package com.ray.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ray.bean.TableColumnConfig;
import com.ray.service.TableColumnConfigService;
import com.ray.util.RequestUtil;
import com.ray.util.ResponseUtil;

@Controller
@RequestMapping("tableCoucmnlConfig")
public class TableColumnConfigController {
	@Autowired
	TableColumnConfigService columnConfigService;
	
	@RequestMapping("/getConfigByName")
	@ResponseBody
	public Map<String,Object> getConfigByName(HttpServletRequest request){
		Map<String,Object> map = RequestUtil.getRequestAllParam(request);
		TableColumnConfig config = columnConfigService.getConfigByName(map);
		return ResponseUtil.ResponseResult(config);
	}
	
	@RequestMapping("/saveConfig")
	@ResponseBody
	public Map<String,String> saveConfig(HttpServletRequest request){
		Map<String,Object> map = RequestUtil.getRequestAllParam(request);
		columnConfigService.saveConfig(map);
		return ResponseUtil.ResponseResult("保存表格显示列配置成功");
	}
}
